from django.conf.urls.defaults import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()


# ---------------MARKET VIEW BY PROBA OR CONTRACT -------------------------
# views linked to the market
urlpatterns = patterns('market.controllerMarketViews',
    (r'^market/$',                      'marketView'),
    (r'^strategies/$',                  'strategiesView'),# by proba only
    (r'^newContract/$',                 'newContractView'),# by contract only
    (r'^portfolio/$',                   'portfolioView'),
    (r'^derivatives/$',                 'derivativesView'),
)


# ---------------MARKET BY CONTRACT -------------------------
# market actions
urlpatterns += patterns('market.controllerContractMarket',
    (r'^submitNewContract/$',           'submitNewContract'),
    (r'^requestSelectedContract/$',     'requestSelectedContract'),
    (r'^hitBid/$',                      'hitBid'),
    (r'^liftOffer/$',                   'liftOffer'),
    (r'^addABid/$',                     'addABid'),
    (r'^addAnOffer/$',                  'addAnOffer'),
    (r'^specifyNumberOfBids/$',         'specifyNumberOfBids'),
    (r'^specifyNumberOfOffers/$',       'specifyNumberOfOffers'),
                        
                        
)

# ---------------MARKET BY PROBA -------------------------
# market actions
urlpatterns += patterns('market.controllerMarket',
    (r'^sellAsset/$',                   'sellAsset'),
    (r'^SubmitNewRepartition/$',        'SubmitNewRepartition'),
    (r'^SubmitNewStrategyMtmRep/$',     'SubmitNewStrategyMtMRep'),
    (r'^killAssetInGloryMode/$',        'killAssetInGloryMode'),
    (r'^addSelectedStratInTable/$',     'addSelectedStratInTable'),
    (r'^removeUninvestedStratFromTable/$','removeUninvestedStratFromTable'),
)

# views linked to the admin of the betroom
urlpatterns += patterns('market.controllerAdminView',
    (r'^admin2/$',                      'admin2Home'),
    (r'^admin2/saveAndCreateAdmin/$',   'saveAndCreateAdmin'),
    (r'^admin2/deleteAssetAdmin/$',     'deleteAssetAdmin'),
    (r'^admin2/addPlayerAdmin/$',       'addPlayerAdmin'),
    (r'^admin2/settleContractView/$',   'settleContractView'),
)

# admin actions
urlpatterns += patterns('market.controllerAdmin',
    (r'^admin2/saveRoom/$',             'saveRoomFromWeb'),
    (r'^admin2/createRoom/$',           'createRoomFromWeb'),
    (r'^admin2/changeDescription/$',    'changeDescription'),
    (r'^admin2/createNewPlayer/$',      'createPlayerWithMktViewAndAverageMtM'),
    (r'^admin2/killAssetMtM/$',         'killAssetMtM'),
    (r'^admin2/killAssetNumbers/$',     'killAssetNumbers'),
    (r'^admin2/fixOrUnfixContract/$',   'fixOrUnfixContract'),
    (r'^admin2/settleContract/$',       'settleContract'),
    (r'^admin2/send_email/$',		'sendEmail'),
    (r'^admin2/suspend/$',              'suspendTransaction'),
    (r'^admin2/resume/$',               'resumeTransaction'),
)


# --------------- CHAT CHART AND COMET -------------------------
# chat
urlpatterns += patterns('market.controllerChat',
    (r'^manageChatConnection/$',         'manageChatConnection'),
)
# automatic update of the windows
urlpatterns += patterns('market.controllerComet',
    (r'^comet/getMarketUpToDateStatus/$','getMarketUpToDateStatus'),
    (r'^comet/getChatUpToDateStatus/$', 'getChatUpToDateStatus'),   
)

# market access to data
urlpatterns += patterns('market.controllerJson',
    (r'^json/getAllJsons/$',            'getAllJsonsForTablesAndCharts'),
    (r'^json/getSpecificJson/$',        'getSpecificJson'),              
)



# --------------- HOME AND BETROOM CREATION-------------------------
# views linked to the home views
urlpatterns += patterns('market.controllerHomeView',
    (r'^$',                             'betroomsView'),
    (r'^celibax/$',                     'betroomsView'),
    (r'^betrooms/$',                    'betroomsView'),# this is to log into a betroom. This is for the mkt, the admin and the creation. But it seemed strange to create one file juste for this one
    (r'^help/$',                        'helpView'),
    (r'^settings/$',                    'settingsView'),
    (r'^rules/$',                       'celibaxRules'),
)

# views linked to the home actions
urlpatterns += patterns('market.controllerHome',
    (r'^enterBetroom/$',                'enterBetroom'),
    (r'^postComment/$',                 'postComment'),
    (r'^hideComment/$',                 'hideComment'),
    #log out
    (r'^logoutView/$',                  'logoutView'),
    # settings: password
    (r'^accounts/password_reset/$',     'reset_password'),
    # settings: emails
    (r'^settings/setSendEmail/$',       'setSendEmail'),
    (r'^settings/setNewEmail/$',        'setNewEmail'),
)



# views linked to the creation of the betroom
urlpatterns += patterns('market.controllerCreateBetroomView',
    (r'^createBetroom/step1/$',         'createBetroom1'),
    (r'^createBetroom/step2/$',         'createBetroom2'),
    (r'^createBetroom/step3/$',         'createBetroom3'),
    (r'^createBetroom/step4/$',         'createBetroom4'),
    (r'^createBetroom/step5/$',         'createBetroom5'),
    (r'^enterBetroom/step1/$',          'enterBetroom1'),
    (r'^enterBetroom/step2/$',          'enterBetroom2'),
)

# views linked to the creation of the betroom
urlpatterns += patterns('market.controllerCreateBetroom',
    (r'^createBetroom/create/$',        'createBetroom'),
    (r'^createBetroom/newAsset/$',      'createAsset'),
    (r'^createBetroom/changeNewAsset/$','changeNewAsset'),
    (r'^createBetroom/deleteNewAsset/$','deleteNewAsset'),
    (r'^createBetroom/validateAssets/$','validateAssets'),
    (r'^createBetroom/adminOrPlayer/$', 'adminOrPlayer'),
    (r'^createBetroom/setViewAdmin/$',	'setViewAdmin'),
    (r'^createBetroom/deleteBetroom/$',	'deleteBetroom'),
    (r'^createBetroom/launchBetroom/$',	'launchBetroom'),
    (r'^enterBetroom/createPlayer/$',	'createPlayer'),
    (r'^enterBetroom/setViewPlayer/$',	'setViewPlayer'),
)

# --------------- ADMIN -------------------------
# login/ logout / admin
urlpatterns += patterns('',

    # authentification account
    (r'^login/$',                       'django.contrib.auth.views.login'),
    (r'^accounts/',                      include('registration.urls')),

    
    # settings: reset the password
    (r'^accounts/password_reset/reset/done/$', 'django.contrib.auth.views.password_reset_done'),
    (r'^accounts/password_reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
           'django.contrib.auth.views.password_reset_confirm',  {'post_reset_redirect' : '/accounts/password_reset/complete/'} ),
    (r'^accounts/password_reset/complete/$', 'django.contrib.auth.views.password_reset_complete'),
                        
    # Uncomment the next line to enable the admin:
    url(r'^admin/',                     include(admin.site.urls)),
)

# static file
urlpatterns += staticfiles_urlpatterns()
